﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Interop.Word;

namespace WFL.Office.Word
{
    public class WordInlineShape
    {
        private readonly object _lock = new object();

        private WordRange _range;
        public WordRange Range
        {
            get
            {
                if (_range == null)
                {
                    lock (_lock) { if (_range == null) { _range = new WordRange(_inlineShape.Range) { Document = Document }; } }
                }
                return _range;
            }
        }

        public float Width
        {
            get { return _inlineShape.Width; }
            set { _inlineShape.Width = value; }
        }

        public float Height
        {
            get { return _inlineShape.Height; }
            set { _inlineShape.Height = value; }
        }

        public float ScaleWidth
        {
            get { return _inlineShape.ScaleWidth; }
            set { _inlineShape.ScaleWidth = value; }
        }

        public float ScaleHeight
        {
            get { return _inlineShape.ScaleHeight; }
            set { _inlineShape.ScaleHeight = value; }
        }

        public TriState LockAspectRatio
        {
            get { return (TriState)_inlineShape.LockAspectRatio; }
            set { _inlineShape.LockAspectRatio = (Microsoft.Office.Core.MsoTriState)value; }
        }

        public InlineShapeType Type
        {
            get { return (InlineShapeType)_inlineShape.Type; }
        }

        private InlineShape _inlineShape;

        public WordDocument Document
        {
            get;
            internal set;
        }

        internal WordInlineShape(InlineShape inlineShape)
        {
            _inlineShape = inlineShape;
        }


    }
}
